package com.lxm.action;

import com.alibaba.fastjson.JSONObject;
import com.lxm.sevice.qq.QQService;
import com.lxm.sevice.wx.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author ：Administrator
 * @date :创建时间 2021/12/29 14:24
 */
@Controller
public class QQACtion extends ActionBase {
    @Autowired
    private WxService wxService;
    @Autowired
    private QQService qqService;

    @RequestMapping(value = "/qq/getAllqqInfo")
    @ResponseBody
    public String get_all_qq_info() {
        List<Map<String, String>> maps = wxService.queryAllQQInfo();
        return JSONObject.toJSONString(maps);
    }

    @RequestMapping(value = "/qq/onMessAge")
    @ResponseBody
    public String onMessAge(@RequestBody  String s) {
        JSONObject jsonObject = JSONObject.parseObject(s);
        if("friend".equals(jsonObject.getString("request_type"))){
            qqService.isAddFriend(jsonObject);
        }
        return "";
    }


}
